package com.xy.xymail.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.xy.common.valid.AddGroup;
import com.xy.common.valid.ListValue;
import com.xy.common.valid.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 *
 * @author xiaye
 * @email 1159395895@qq.com
 * @date 2020-05-17 19:11:46
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@NotNull(message = "修改时，品牌id必须指定",groups = {UpdateGroup.class})
	@Null(message = "新增时不能指定id",groups = {AddGroup.class})
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名必须要提交",groups = {AddGroup.class,UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@URL(message = "logo必须是一个合法的url地址",groups = {AddGroup.class,UpdateGroup.class})
	@NotEmpty(message = "插入时logo地址不能为空",groups = {AddGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ListValue(vals={0,1})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotEmpty(message = "插入时，首字母检索不能为空",groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",groups = {AddGroup.class,UpdateGroup.class},message = "检索的首字母不符合规范")
	private String firstLetter;
	/**
	 * 排序
	 */
	@Min(value = 0,message = "最小的排序值不能小于0 ",groups = {AddGroup.class,UpdateGroup.class})
	@NotNull(groups = {AddGroup.class},message = "插入时，排序字段不能为空")
	private Integer sort;

}
